#ifndef _STACK_H_
#define _STACK_H_

#ifdef __cplusplus
extern "C"{
#endif



#define SD_STACK_INIT_SIZE 32

struct __xs_stack {
    size_t max;
    size_t sp;
    size_t size;
    size_t iter;
    void **array;
};

typedef struct __xs_stack xs_stack_t;

extern xs_stack_t* 	xs_stack_new(size_t );
extern void			xs_stack_delete(xs_stack_t* , void (*free_data_fn)(void *));
extern size_t			xs_stack_get_nelem(const xs_stack_t* );

extern void			xs_stack_clear(xs_stack_t* , void (*free_data_fn)(void *));
extern int			xs_stack_push(xs_stack_t* , void *);
extern void*			xs_stack_pop(xs_stack_t* );
extern void*			xs_stack_begin(xs_stack_t* );
extern void*			xs_stack_next(xs_stack_t* );
extern void*			xs_stack_end(xs_stack_t* );
extern void*			xs_stack_peek(xs_stack_t* );


#ifdef __cplusplus
}
#endif
#endif

